package cn.wizzer.app.web.modules.controllers.platform.user;

import cn.wizzer.app.user.modules.services.DailyReportService;
import cn.wizzer.framework.util.Result;
import com.alibaba.dubbo.config.annotation.Reference;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;

/**
 * 日常统计
 *
 * @author .
 */
@IocBean
@At("/platform/user/daily/statistics")
public class DailyReportController {
    @Inject
    @Reference
    private DailyReportService dailyReportService;


    @At("/")
    @Ok("beetl:/platform/user/daily/index.html")
    @RequiresPermissions("user.statistics.daily")
    public void index() {
    }

    /**
     * 统计每日 赠送人数 |赠送金额 |新充值人数 |充值总金额 |二次总充值人数 |二次充值总金额 | 值总人数 |注册人数
     *
     * @param searchDate 日期
     * @return
     */
    @At
    @Ok("json:full")
    @RequiresPermissions("user.statistics.daily")
    public Object data(@Param("searchDate") String[] searchDate) {
        return Result.success().addData(dailyReportService.data(searchDate));
    }


}
